Repository navigation
feat: stream per-message flows through the collector - #83
Merged
Merged
Conversation
Each node counts the messages it sends per peer and kind and posts them to POST /v1/flows every 250 ms when --collector-url is set. The collector merges them and fans them out every 100 ms on GET /v1/flows/stream, separate from the graph stream so a burst cannot force viewers to resync. Lossy by design: busy or failed batches are dropped.
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Lets the collector see which node sent which node a message, so the viz can draw each message from sender to receiver.
sendis counted by (peer, kind). Every 250 ms the counts go out as aFlowReport. Only when--collector-urlis set.POST /v1/flows. Lossy on purpose: a busy channel or a failed post drops the batch, with no retry.GET /v1/flows/stream(SSE eventflows, CORS open). It's a separate stream from/v1/graph/stream, so a burst of messages can't force graph viewers to resync. A slow subscriber misses batches rather than being disconnected. Nothing is buffered when nobody is subscribed.Kind.String()gives the stream readable kind names.Event payload:
{"at":"…","flows":[{"from":"<id>","to":"<id>","kind":"heartbeat","count":1}]}Load
Heartbeats dominate: every link sends one each way every 500 ms (about 470 per second on 24 nodes). Each node makes one small POST per 250 ms while it is sending anything.
Testing
go test -race ./internal/... ./cmd/...passes.feat/message-flows).🤖 Generated with Claude Code